{% extends "base.html" %}
{% block page %}
    <div class="div">{{ lable }}</div>
    <div style="width: 99%">
         <table id="make_table" class="table table-striped table-bordered table-hover table-condensed">
            <thead>
                <tr>
                    {% for tab in tables %}
                        <td class="table_list" style="text-align: center">{{ tab }}</td>
                    {% endfor %}
                </tr>
            </thead>
             <tbody>
             {% if vals %}
                 {% for val in vals %}
                    <tr>
                        {% if '.' in val[0]  %}
                            <td class="table_list" style="text-align: center">{{ val[0] }}</td>
                        {% else %}
                            <td class="table_list" style="text-align: center">
                                <a href="/assets_get?type=server&hostname={{ val[0] }}" style="float: left;margin-left: 40%">{{ val[0] }}</a>
                            </td>
                        {% endif %}
                        <td class="table_list" style="text-align: center">{{ val[1] }}</td>
                        {% for va in val[2:4] %}
                            {% if va %}
                                <td class="table_list" style="text-align: center;font-weight:bold">{{ va }}</td>
                            {% else %}
                                <td class="table_list" style="text-align: center"></td>
                            {% endif %}
                        {% endfor %}
                        {% for va in val[4:-3] %}
                            {% if va == '是' %}
                                <td class="table_list" style="text-align: center;color: red;font-weight:bold">{{ va }}</td>
                            {% else %}
                                <td class="table_list" style="text-align: center">{{ va }}</td>
                            {% endif %}
                        {% endfor %}
                        {% if '.' in val[-3]  %}
                            <td class="table_list" style="text-align: center">{{ val[-3] }}</td>
                        {% else %}
                            <td class="table_list" style="text-align: center">
                                {% if val[-3] %}
                                    <a href="/assets_get?type=server&hostname={{ val[-3] }}">{{ val[-3] }}</a>
                                    <a href="/redis_master/{{ val[-3] }}:{{ val[-2] }}" style="color:dodgerblue;float: right ">
                                        <i class="fas fa-code-branch fa-rotate-90" ></i>
                                    </a>
                                {% endif %}
                            </td>
                        {% endif %}
                        <td class="table_list" style="text-align: center">{{ val[-2] }}</td>
                        {% if "%s:%s" %(val[0],val[1]) in redis_unhealth %}
                            <td class="table_list" style="text-align: center;color: red">服务异常</td>
                        {% elif val[-1] != uptime %}
                            <td class="table_list" style="text-align: center;color: blueviolet">疑似下架</td>
                        {% else %}
                            <td class="table_list" style="text-align: center;color: green">服务正常</td>
                        {% endif %}
                    </tr>
                 {% endfor %}
             {% endif %}
             </tbody>
         </table>
    </div>
    <script>
        $(document).ready(table_order('make_table',0));
    </script>
{% endblock page %}